public OnPlayerRequestClass(playerid, classid) 
{
	new autoAssignTeam;
		
	// Now we set the player's position.
    CPlayer::setUpForClassSelect(playerid);
	
	switch (classid) 
	{
		case 0: 
		{
			autoAssignTeam = getTeamWithLessPlayers();
			
			SetPlayerSkin(playerid, gameConfig[teamSkin][autoAssignTeam]);
			playerData[playerid][team] = autoAssignTeam;
			
			playerData[playerid][isAutoAssigned] = true;
		}
			
		case 1: 
		{
			SetPlayerSkin(playerid, gameConfig[teamSkin][TEAM_HOME]);
			playerData[playerid][team] = TEAM_HOME;
			playerData[playerid][isAutoAssigned] = false;
		}
		
		case 2: 
		{
			SetPlayerSkin(playerid, gameConfig[teamSkin][TEAM_AWAY]);
			playerData[playerid][team] = TEAM_AWAY;
			playerData[playerid][isAutoAssigned] = false;
		}
		
		case 3: 
		{
			SetPlayerSkin(playerid, gameConfig[teamSkin][TEAM_REF]);
			playerData[playerid][team] = TEAM_REF;
			playerData[playerid][isAutoAssigned] = false;
		}
		
		case 4: 
		{
			SetPlayerSkin(playerid, gameConfig[teamSkin][TEAM_HOME]);
			playerData[playerid][team] = TEAM_HOME_SUB;
			playerData[playerid][isAutoAssigned] = false;
		}
		
		case 5: 
		{
			SetPlayerSkin(playerid, gameConfig[teamSkin][TEAM_AWAY]);
			playerData[playerid][team] = TEAM_AWAY_SUB;
			playerData[playerid][isAutoAssigned] = false;
		}
	}
    
    if (playerData[playerid][isRegistered] && !playerData[playerid][isLogged]) 
    {
	    SendClientMessage(playerid, C_GREEN, "It seems that you are {FF0000}registered{33FF00}, you will have to {FF0000}login{33FF00} now to spawn.");
	    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login Box", "{FFFFFF}Please enter your {FF0000}password{FFFFFF} to spawn", "Login", "Quit");
	}

	else if (!playerData[playerid][isRegistered] && !playerData[playerid][isLogged]) 
    {
	    SendClientMessage(playerid, C_GREEN, "It seems that you are {FF0000}not registered{33FF00}, you will have to {FF0000}register{33FF00} now to spawn.");
	    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register Box", "{FF0000}Please register first\n{FFFFFF}Enter your password below", "Register", "Quit");
 	}
 	
	CPlayer::showTeamInfo(playerid, classid);
	return true;
}